---
layout: "default"
title: "indices"
description: "Swift documentation for 'indices': Return the range of x &#39;s valid index values."
keywords: "indices,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-indices-c_-collectiontype_-c">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-indices-c_-collectiontype_-c">func <wbr>indices&lt;C : CollectionType&gt;(<wbr>_: C)</a>
        
<div class="comment collapse" id="comment-func-indices-c_-collectiontype_-c"><div class="p">
    <p>Return the range of <code>x</code> &#39;s valid index values.</p>

<p>The result&#39;s <code>endIndex</code> is the same as that of <code>x</code>.  Because
<code>Range</code> is half-open, iterating the values of the result produces
all valid subscript arguments for <code>x</code>, omitting its <code>endIndex</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func indices&lt;C : CollectionType&gt;(x: C) -&gt; Range&lt;C.Index&gt;</code>
    
    
</div></div>
</div>
